import { createRouter, createWebHashHistory } from 'vue-router'

import MainLogin from '@/views/login.vue'
import MainLayout from '@/views/index.vue'

import ArticleCategoryVue from '@/views/admin/article/ArticleCategory.vue'
import ArticleManageVue from '@/views/admin/article/ArticleManage.vue'
import UserAvatarVue from '@/views/admin/user/UserAvatar.vue'
import UserInfoVue from '@/views/admin/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/admin/user/UserResetPassword.vue'
import CodeIng from "@/views/coding.vue";
import MainPage from "@/views/admin/main.vue"
import PanelIndex from "@/views/admin/panel/PanelIndex.vue"
import SchoolAdmin from "@/views/admin/school/SchoolAdmin.vue"

import TabMain from "@/views/frontend/tab/TabMain.vue"
import TabPage1 from "@/views/frontend/tab/TabPage1.vue"
import TabPage2 from "@/views/frontend/tab/TabPage2.vue"
import TabPage3 from "@/views/frontend/tab/TabPage3.vue"
import TabPage4 from "@/views/frontend/tab/TabPage4.vue"
import TabPage5 from "@/views/frontend/tab/TabPage5.vue"
import SideRight from "@/views/frontend/side/SideRight.vue";
import TextPage from "@/views/frontend/text/text.vue"

import BlogIndex from "@/views/frontend/HomePage.vue"

const routes = [
  {
    path: '/',
    component: MainLogin
  },
  {
    path: '/layout',
    component: MainLayout,
    redirect: '/main',
    children: [
      {
        path: '/main',
        component: MainPage,
        redirect:'/panel/panel',
        children: [
          { path: '/article/category', component: ArticleCategoryVue },
          { path: '/article/manage', component: ArticleManageVue },
          { path: '/article/manage', component: UserInfoVue },
          { path: '/user/avatar', component: UserAvatarVue },
          { path: '/user/resetPassword', component: UserResetPasswordVue },
          { path: '/user/info', component: UserInfoVue },
          { path: '/panel/panel', component: PanelIndex },
          { path: '/school', component: SchoolAdmin}
        ]
      },
      {
        path: '/blog',
        component: BlogIndex,
        redirect: '/blog/tab',
        children: [
          {
            path: '/blog/tab',
            component: TabMain,
            redirect: '/blog/tab1',
            children: [
              { path: '/blog/tab1', component: TabPage1 },
              { path: '/blog/tab2', component: TabPage2 },
              { path: '/blog/tab3', component: TabPage3 },
              { path: '/blog/tab4', component: TabPage4 },
              { path: '/blog/tab5', component: TabPage5 },
            ]
          },
          { path: '/blog/side', component: SideRight },
          { path: '/blog/text/:id', component: TextPage },
        ]
      },
      {
        path: '/coding',
        component: CodeIng
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
